
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module build</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>build</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/devel/closure-modules/build.py">/devel/closure-modules/build.py</a></font></td></tr></table>
    <p><tt>Copyright&nbsp;2010&nbsp;Jay&nbsp;Young<br>
&nbsp;<br>
Licensed&nbsp;under&nbsp;the&nbsp;Apache&nbsp;License,&nbsp;Version&nbsp;2.0&nbsp;(the&nbsp;"License");<br>
you&nbsp;may&nbsp;not&nbsp;use&nbsp;this&nbsp;file&nbsp;except&nbsp;in&nbsp;compliance&nbsp;with&nbsp;the&nbsp;License.<br>
You&nbsp;may&nbsp;obtain&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;License&nbsp;at<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br>
&nbsp;<br>
Unless&nbsp;required&nbsp;by&nbsp;applicable&nbsp;law&nbsp;or&nbsp;agreed&nbsp;to&nbsp;in&nbsp;writing,&nbsp;software<br>
distributed&nbsp;under&nbsp;the&nbsp;License&nbsp;is&nbsp;distributed&nbsp;on&nbsp;an&nbsp;"AS&nbsp;IS"&nbsp;BASIS,<br>
WITHOUT&nbsp;WARRANTIES&nbsp;OR&nbsp;CONDITIONS&nbsp;OF&nbsp;ANY&nbsp;KIND,&nbsp;either&nbsp;express&nbsp;or&nbsp;implied.<br>
See&nbsp;the&nbsp;License&nbsp;for&nbsp;the&nbsp;specific&nbsp;language&nbsp;governing&nbsp;permissions&nbsp;and<br>
limitations&nbsp;under&nbsp;the&nbsp;License.<br>
&nbsp;<br>
Author:&nbsp;Jay&nbsp;Young&nbsp;(jayyoung9909@gmail.com)</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="json.html">json</a><br>
<a href="logging.html">logging</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="re.html">re</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="build.html#ModuleBuilder">ModuleBuilder</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="ModuleBuilder">class <strong>ModuleBuilder</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Automatically&nbsp;compiles&nbsp;your&nbsp;project&nbsp;into&nbsp;user-defined&nbsp;modules.<br>
&nbsp;<br>
The&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;class&nbsp;is&nbsp;responsible&nbsp;for&nbsp;parsing&nbsp;the&nbsp;module&nbsp;and&nbsp;namespace<br>
dependencies&nbsp;in&nbsp;your&nbsp;project&nbsp;and&nbsp;passing&nbsp;your&nbsp;code&nbsp;to&nbsp;the&nbsp;Closure&nbsp;Compiler<br>
so&nbsp;as&nbsp;to&nbsp;generate&nbsp;user-defined&nbsp;modules.<br>
&nbsp;<br>
For&nbsp;readability,&nbsp;the&nbsp;term&nbsp;"modules.js"&nbsp;is&nbsp;used&nbsp;to&nbsp;refer&nbsp;to&nbsp;the&nbsp;file&nbsp;passed<br>
in&nbsp;to&nbsp;the&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;instance&nbsp;that&nbsp;defines&nbsp;the&nbsp;modules&nbsp;structure.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;modules_file_name:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;file&nbsp;that&nbsp;defines&nbsp;your&nbsp;project's&nbsp;modules.<br>
&nbsp;&nbsp;<br>
Attributes:<br>
&nbsp;&nbsp;init_level:&nbsp;How&nbsp;far&nbsp;along&nbsp;the&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;instance&nbsp;is&nbsp;towards&nbsp;its&nbsp;full<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initialization.<br>
&nbsp;&nbsp;modules:&nbsp;A&nbsp;list&nbsp;of&nbsp;module&nbsp;objects&nbsp;parsed&nbsp;from&nbsp;the&nbsp;given&nbsp;modules.js&nbsp;file<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;module&nbsp;objects&nbsp;in&nbsp;the&nbsp;list&nbsp;will&nbsp;accumulate&nbsp;most&nbsp;of&nbsp;the&nbsp;key<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;information&nbsp;required&nbsp;to&nbsp;perform&nbsp;the&nbsp;script's&nbsp;actions.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defined&nbsp;in:&nbsp;`<a href="#ModuleBuilder-parse_modules">parse_modules</a>()`<br>
&nbsp;&nbsp;n_dependency_map:&nbsp;A&nbsp;map&nbsp;of&nbsp;all&nbsp;namespaces&nbsp;to&nbsp;their&nbsp;nDependencies.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defined&nbsp;in:&nbsp;`<a href="#ModuleBuilder-map_namespace_dependencies">map_namespace_dependencies</a>()`<br>
&nbsp;&nbsp;namespace_filenames:&nbsp;A&nbsp;map&nbsp;of&nbsp;namespaces&nbsp;to&nbsp;the&nbsp;files&nbsp;in&nbsp;which&nbsp;they're<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defined.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defined&nbsp;in:&nbsp;`<a href="#ModuleBuilder-map_namespace_dependencies">map_namespace_dependencies</a>()`<br>
&nbsp;&nbsp;namespaces_to_module_map:&nbsp;A&nbsp;map&nbsp;of&nbsp;namespaces&nbsp;to&nbsp;the&nbsp;names&nbsp;of&nbsp;all&nbsp;modules<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;which&nbsp;they&nbsp;are&nbsp;required.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defined&nbsp;in:&nbsp;<a href="#ModuleBuilder-map_module_namespaces">map_module_namespaces</a>()`<br>
&nbsp;&nbsp;modules_map:&nbsp;A&nbsp;map&nbsp;of&nbsp;module&nbsp;names&nbsp;to&nbsp;their&nbsp;defining&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;in&nbsp;`modules`<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ModuleBuilder-__init__"><strong>__init__</strong></a>(self, modules_file_name<font color="#909090">=u'modules.js'</font>)</dt><dd><tt>Set&nbsp;up&nbsp;the&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;instance&nbsp;state</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-analyze_dependencies_across_modules"><strong>analyze_dependencies_across_modules</strong></a>(self)</dt><dd><tt>Determine&nbsp;what&nbsp;module&nbsp;each&nbsp;required&nbsp;namespace&nbsp;should&nbsp;be&nbsp;in.<br>
&nbsp;<br>
Analyze&nbsp;the&nbsp;m-&nbsp;and&nbsp;nDependency&nbsp;trees&nbsp;to&nbsp;determine&nbsp;what&nbsp;module&nbsp;each<br>
required&nbsp;namespace&nbsp;needs&nbsp;to&nbsp;be&nbsp;included&nbsp;with.&nbsp;&nbsp;This&nbsp;is&nbsp;done&nbsp;by<br>
finding&nbsp;all&nbsp;modules&nbsp;that&nbsp;require&nbsp;each&nbsp;namespace&nbsp;and&nbsp;finding&nbsp;the<br>
closest&nbsp;parent&nbsp;module&nbsp;(think&nbsp;least&nbsp;common&nbsp;denominator)&nbsp;to&nbsp;ensure&nbsp;that&nbsp;code<br>
is&nbsp;not&nbsp;loaded&nbsp;until&nbsp;absolutely&nbsp;necessary.<br>
&nbsp;<br>
Defines:<br>
&nbsp;&nbsp;self.<strong>module_parent_cache</strong>:&nbsp;Results&nbsp;from&nbsp;finding&nbsp;the&nbsp;parent&nbsp;of&nbsp;multiple<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modules</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-compile"><strong>compile</strong></a>(self)</dt><dd><tt>Calls&nbsp;the&nbsp;Closure&nbsp;Compiler&nbsp;with&nbsp;the&nbsp;necessary&nbsp;inputs&nbsp;to&nbsp;build&nbsp;the&nbsp;app.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-find_closest_parent"><strong>find_closest_parent</strong></a>(self, target_modules)</dt><dd><tt>Find&nbsp;the&nbsp;closest&nbsp;parent&nbsp;module&nbsp;to&nbsp;those&nbsp;given<br>
&nbsp;<br>
Find&nbsp;the&nbsp;module&nbsp;that&nbsp;is&nbsp;as&nbsp;close&nbsp;as&nbsp;possible&nbsp;to&nbsp;those&nbsp;given&nbsp;in&nbsp;the&nbsp;module<br>
dependency&nbsp;graph.&nbsp;&nbsp;This&nbsp;is&nbsp;done&nbsp;in&nbsp;a&nbsp;few&nbsp;steps:<br>
&nbsp;<br>
1)&nbsp;&nbsp;If&nbsp;only&nbsp;one&nbsp;module&nbsp;is&nbsp;passed&nbsp;in,&nbsp;that's&nbsp;the&nbsp;one.<br>
2)&nbsp;&nbsp;If&nbsp;we've&nbsp;already&nbsp;computed&nbsp;this,&nbsp;return&nbsp;the&nbsp;result&nbsp;from<br>
&nbsp;&nbsp;&nbsp;&nbsp;self.<strong>module_parent_cache</strong>.<br>
3)&nbsp;&nbsp;Determine&nbsp;if&nbsp;one&nbsp;of&nbsp;the&nbsp;given&nbsp;modules&nbsp;is&nbsp;a&nbsp;parent&nbsp;of&nbsp;all&nbsp;the&nbsp;others.<br>
&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;one&nbsp;of&nbsp;them&nbsp;is,&nbsp;return&nbsp;that&nbsp;one.<br>
4)&nbsp;&nbsp;If&nbsp;all&nbsp;else&nbsp;fails,&nbsp;iterate&nbsp;through&nbsp;the&nbsp;entire&nbsp;self.<strong>modules</strong>&nbsp;array&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;find&nbsp;the&nbsp;one&nbsp;with&nbsp;the&nbsp;lowest&nbsp;aggregate&nbsp;'level'.&nbsp;&nbsp;In&nbsp;the&nbsp;example&nbsp;below,<br>
&nbsp;&nbsp;&nbsp;&nbsp;'settings'&nbsp;is&nbsp;one&nbsp;level&nbsp;below&nbsp;'core'.&nbsp;&nbsp;'core'&nbsp;has&nbsp;an&nbsp;aggregate&nbsp;level<br>
&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;2&nbsp;above&nbsp;['settings',&nbsp;'view']&nbsp;and&nbsp;3&nbsp;above&nbsp;['settings',&nbsp;'upload'].<br>
&nbsp;&nbsp;&nbsp;&nbsp;Computing&nbsp;the&nbsp;parent&nbsp;modules&nbsp;for&nbsp;two&nbsp;non-interdependent&nbsp;modules&nbsp;is<br>
&nbsp;&nbsp;&nbsp;&nbsp;expensive,&nbsp;and&nbsp;a&nbsp;good&nbsp;argument&nbsp;for&nbsp;using&nbsp;a&nbsp;shallow&nbsp;module&nbsp;dependency<br>
&nbsp;&nbsp;&nbsp;&nbsp;graph.<br>
&nbsp;<br>
Example:<br>
&nbsp;&nbsp;core<br>
&nbsp;&nbsp;|--settings<br>
&nbsp;&nbsp;|--view<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|--upload<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;target_modules:&nbsp;A&nbsp;list&nbsp;of&nbsp;module&nbsp;names&nbsp;whose&nbsp;closest&nbsp;parent&nbsp;we're<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trying&nbsp;to&nbsp;find.<br>
&nbsp;<br>
Return:<br>
&nbsp;&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;module&nbsp;in&nbsp;which&nbsp;this&nbsp;namespace&nbsp;should&nbsp;be&nbsp;included.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-get_n_dependency_list"><strong>get_n_dependency_list</strong></a>(self, namespaces, module)</dt><dd><tt>Recursively&nbsp;map&nbsp;the&nbsp;nDependencies&nbsp;of&nbsp;a&nbsp;list&nbsp;of&nbsp;namespaces<br>
&nbsp;<br>
Helper&nbsp;method&nbsp;for&nbsp;`map_module_namespaces`.<br>
Given&nbsp;a&nbsp;list&nbsp;of&nbsp;namespaces,&nbsp;recursively&nbsp;traverse&nbsp;self.<strong>n_dependency_map</strong><br>
and&nbsp;build&nbsp;an&nbsp;ordered&nbsp;list&nbsp;of&nbsp;all&nbsp;dependencies&nbsp;for&nbsp;each&nbsp;namespace&nbsp;in&nbsp;the<br>
module,&nbsp;starting&nbsp;from&nbsp;the&nbsp;top&nbsp;down.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;namespaces:&nbsp;A&nbsp;list&nbsp;of&nbsp;namespaces&nbsp;whose&nbsp;dependencies&nbsp;we&nbsp;need&nbsp;to&nbsp;map<br>
&nbsp;&nbsp;module:&nbsp;The&nbsp;module&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;from&nbsp;self.<strong>modules</strong></tt></dd></dl>

<dl><dt><a name="ModuleBuilder-load_deps_file"><strong>load_deps_file</strong></a>(self, filename, root_path, pattern)</dt><dd><tt>Parse&nbsp;a&nbsp;dependency&nbsp;file&nbsp;into&nbsp;a&nbsp;namespace&nbsp;dependency&nbsp;map.<br>
&nbsp;<br>
Helper&nbsp;method&nbsp;for&nbsp;map_namespace_dependencies.<br>
Read&nbsp;in&nbsp;a&nbsp;dependency&nbsp;file&nbsp;created&nbsp;using&nbsp;depswriter.py,&nbsp;parse&nbsp;the<br>
dependencies,&nbsp;and&nbsp;append&nbsp;them&nbsp;to&nbsp;the&nbsp;given&nbsp;dict.&nbsp;&nbsp;This&nbsp;is&nbsp;split&nbsp;into&nbsp;its<br>
own&nbsp;method&nbsp;so&nbsp;we&nbsp;can&nbsp;use&nbsp;the&nbsp;given&nbsp;deps.js&nbsp;file&nbsp;for&nbsp;the&nbsp;Closure&nbsp;library&nbsp;and<br>
only&nbsp;have&nbsp;to&nbsp;run&nbsp;depswriter.py&nbsp;on&nbsp;user-defined&nbsp;code.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;The&nbsp;name&nbsp;(including&nbsp;path)&nbsp;of&nbsp;the&nbsp;deps&nbsp;file&nbsp;to&nbsp;parse.<br>
&nbsp;&nbsp;root_path:&nbsp;The&nbsp;path&nbsp;to&nbsp;append&nbsp;to&nbsp;the&nbsp;beginning&nbsp;of&nbsp;the&nbsp;file&nbsp;name.<br>
&nbsp;&nbsp;pattern:&nbsp;The&nbsp;RegExp&nbsp;pattern.&nbsp;&nbsp;Passed&nbsp;in&nbsp;to&nbsp;prevent&nbsp;multiple&nbsp;compilations.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-map_module_namespaces"><strong>map_module_namespaces</strong></a>(self)</dt><dd><tt>Map&nbsp;the&nbsp;goog.*&nbsp;and&nbsp;app&nbsp;namespaces&nbsp;that&nbsp;belong&nbsp;in&nbsp;each&nbsp;module<br>
&nbsp;<br>
Read&nbsp;the&nbsp;namespaces&nbsp;array&nbsp;in&nbsp;each&nbsp;module&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;and&nbsp;recursively&nbsp;map&nbsp;out&nbsp;the<br>
full&nbsp;dependency&nbsp;tree&nbsp;for&nbsp;that&nbsp;module,&nbsp;including&nbsp;both&nbsp;user-defined&nbsp;and<br>
goog.*&nbsp;namespaces.<br>
&nbsp;<br>
Defines:<br>
&nbsp;&nbsp;self.<strong>namespaces_to_module_map</strong>:&nbsp;A&nbsp;map&nbsp;of&nbsp;namespaces&nbsp;to&nbsp;the&nbsp;modules&nbsp;in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;which&nbsp;they&nbsp;are&nbsp;required.<br>
&nbsp;&nbsp;self.<strong>modules</strong>[i]["n_dependency_list"]:&nbsp;A&nbsp;list&nbsp;in&nbsp;nDependency&nbsp;order&nbsp;for<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;each&nbsp;module&nbsp;<a href="__builtin__.html#object">object</a>.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-map_namespace_dependencies"><strong>map_namespace_dependencies</strong></a>(self)</dt><dd><tt>Maps&nbsp;namespaces&nbsp;to&nbsp;their&nbsp;dependencies,&nbsp;both&nbsp;goog.*&nbsp;and&nbsp;user-defined.<br>
&nbsp;<br>
Uses&nbsp;the&nbsp;depswriter.py&nbsp;utility&nbsp;to&nbsp;build&nbsp;the&nbsp;dependency&nbsp;file&nbsp;for&nbsp;goog.*&nbsp;and<br>
user-defined&nbsp;namespaces,&nbsp;then&nbsp;parses&nbsp;to&nbsp;build&nbsp;a&nbsp;map&nbsp;of&nbsp;all&nbsp;namespaces&nbsp;to<br>
their&nbsp;nDependencies.<br>
&nbsp;<br>
Defines:<br>
&nbsp;&nbsp;self.<strong>n_dependency_map</strong><br>
&nbsp;&nbsp;self.<strong>namespace_filenames</strong><br>
&nbsp;&nbsp;self.<strong>filenames_to_namespaces</strong><br>
&nbsp;&nbsp;<br>
TODO:<br>
&nbsp;&nbsp;Change&nbsp;path&nbsp;assumptions&nbsp;to&nbsp;accept&nbsp;command-line&nbsp;argument.<br>
&nbsp;&nbsp;Update&nbsp;method&nbsp;to&nbsp;interface&nbsp;with&nbsp;the&nbsp;other&nbsp;tools&nbsp;directly&nbsp;instead&nbsp;of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executing&nbsp;depswriter.py&nbsp;and&nbsp;parsing&nbsp;output.<br>
&nbsp;&nbsp;Instead&nbsp;of&nbsp;hard-coding&nbsp;the&nbsp;three&nbsp;deps&nbsp;files&nbsp;(Closure&nbsp;Lib,&nbsp;third&nbsp;party,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;app&nbsp;deps&nbsp;files),&nbsp;set&nbsp;up&nbsp;to&nbsp;alllow&nbsp;a&nbsp;variable&nbsp;number.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-mark_dependency"><strong>mark_dependency</strong></a>(self, module_name, dependencies, level)</dt><dd><tt>Mark&nbsp;out&nbsp;a&nbsp;module's&nbsp;dependency&nbsp;path.<br>
&nbsp;<br>
Helper&nbsp;method&nbsp;for&nbsp;mark_module_dependencies&nbsp;that&nbsp;recursively&nbsp;traverses&nbsp;the<br>
mDependency&nbsp;tree.&nbsp;&nbsp;This&nbsp;method&nbsp;adds&nbsp;an&nbsp;array&nbsp;to&nbsp;each&nbsp;module<br>
in&nbsp;the&nbsp;self.<strong>modules</strong>&nbsp;array&nbsp;containsing&nbsp;a&nbsp;list&nbsp;of&nbsp;mDependents<br>
and&nbsp;how&nbsp;many&nbsp;levels&nbsp;up&nbsp;their&nbsp;mDependency&nbsp;tree&nbsp;this&nbsp;module&nbsp;is.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;module_name:&nbsp;The&nbsp;module&nbsp;whose&nbsp;mDependency&nbsp;tree&nbsp;is&nbsp;being&nbsp;traversed.<br>
&nbsp;&nbsp;dependencies:&nbsp;The&nbsp;mDependencies&nbsp;array&nbsp;in&nbsp;the&nbsp;module&nbsp;dict&nbsp;from&nbsp;modules.js<br>
&nbsp;&nbsp;level:&nbsp;Current&nbsp;depth&nbsp;into&nbsp;the&nbsp;mDependency&nbsp;tree</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-mark_module_dependencies"><strong>mark_module_dependencies</strong></a>(self)</dt><dd><tt>Traverse&nbsp;modules&nbsp;array&nbsp;to&nbsp;mark&nbsp;module&nbsp;dependents.<br>
&nbsp;<br>
Iterates&nbsp;through&nbsp;the&nbsp;modules&nbsp;array&nbsp;to&nbsp;mark&nbsp;out&nbsp;mDependency&nbsp;paths.<br>
See&nbsp;mark_dependency&nbsp;for&nbsp;further&nbsp;documentation.</tt></dd></dl>

<dl><dt><a name="ModuleBuilder-parse_modules"><strong>parse_modules</strong></a>(self)</dt><dd><tt>Read&nbsp;and&nbsp;parse&nbsp;the&nbsp;module&nbsp;config&nbsp;file&nbsp;passed&nbsp;to&nbsp;__init__<br>
&nbsp;<br>
`<a href="#ModuleBuilder-parse_modules">parse_modules</a>()`&nbsp;builds&nbsp;the&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>.modules&nbsp;list&nbsp;from&nbsp;the&nbsp;given<br>
configuration&nbsp;file.&nbsp;&nbsp;This&nbsp;module&nbsp;objects&nbsp;in&nbsp;the&nbsp;list&nbsp;contains:<br>
&nbsp;&nbsp;'name':&nbsp;&nbsp;Name&nbsp;of&nbsp;the&nbsp;module&nbsp;being&nbsp;described<br>
&nbsp;&nbsp;'mDepdendencies':&nbsp;The&nbsp;modules&nbsp;on&nbsp;which&nbsp;this&nbsp;module&nbsp;is&nbsp;dependent<br>
&nbsp;&nbsp;'namespaces':&nbsp;The&nbsp;user-defined&nbsp;namespaces&nbsp;in&nbsp;this&nbsp;module<br>
&nbsp;&nbsp;<br>
Defines:<br>
&nbsp;&nbsp;self.<strong>modules</strong><br>
&nbsp;&nbsp;<br>
TODO:<br>
&nbsp;&nbsp;Instead&nbsp;of&nbsp;taking&nbsp;input&nbsp;from&nbsp;a&nbsp;modules&nbsp;config&nbsp;file,&nbsp;decide&nbsp;if&nbsp;we&nbsp;want&nbsp;to<br>
&nbsp;&nbsp;parse&nbsp;the&nbsp;source&nbsp;directly&nbsp;for&nbsp;some&nbsp;module-declaring&nbsp;primitives.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>InitLevel</strong> = &lt;class 'build.InitLevel'&gt;<dd><tt>Enum&nbsp;to&nbsp;describe&nbsp;the&nbsp;current&nbsp;loading&nbsp;stage&nbsp;of&nbsp;the&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;instance<br>
&nbsp;<br>
The&nbsp;<a href="#ModuleBuilder">ModuleBuilder</a>&nbsp;instance&nbsp;can&nbsp;be&nbsp;progressively&nbsp;initialized,&nbsp;so&nbsp;the&nbsp;class<br>
members&nbsp;of&nbsp;this&nbsp;represent&nbsp;the&nbsp;possible&nbsp;incremental&nbsp;states:<br>
&nbsp;<br>
Attributes:<br>
&nbsp;&nbsp;UNINITIALIZED:&nbsp;The&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;has&nbsp;been&nbsp;constructed&nbsp;but&nbsp;done&nbsp;no&nbsp;processing.<br>
&nbsp;&nbsp;PARSED_MODULES:&nbsp;The&nbsp;given&nbsp;file&nbsp;describing&nbsp;the&nbsp;modules&nbsp;has&nbsp;been&nbsp;parsed.<br>
&nbsp;&nbsp;M_DEPENDENCIES_MARKED:&nbsp;The&nbsp;mDependency&nbsp;tree&nbsp;has&nbsp;been&nbsp;built.<br>
&nbsp;&nbsp;N_DEPENDENCIES_MARKED:&nbsp;The&nbsp;nDependency&nbsp;tree&nbsp;has&nbsp;been&nbsp;built.<br>
&nbsp;&nbsp;MODULE_NAMESPACES_MAPPED:&nbsp;Namespaces&nbsp;have&nbsp;been&nbsp;mapped&nbsp;to&nbsp;the&nbsp;modules&nbsp;that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use&nbsp;them.<br>
&nbsp;&nbsp;DEPENDENCIES_PLACED:&nbsp;Namespaces&nbsp;have&nbsp;been&nbsp;placed&nbsp;in&nbsp;the&nbsp;modules&nbsp;that&nbsp;most<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;make&nbsp;sense.</tt></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-main"><strong>main</strong></a>()</dt></dl>
</td></tr></table>
</body></html>